package cn.woniu.util;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author 潘冰
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResponseResult<T>{
    private Integer code;
    private String msg;
    private T data;

    public static final   ResponseResult<Void>  SECCUSS=
            new ResponseResult(ResultEnum.SUCCESS.getCode(),ResultEnum.SUCCESS.getMsg()) ;
    public static final ResponseResult<Void> FAIL =
            new ResponseResult(ResultEnum.FAIL.getCode(), ResultEnum.FAIL.getMsg());

    public static final ResponseResult<Void> NOLOGIN =
            new ResponseResult(ResultEnum.NOLOGIN.getCode(), ResultEnum.NOLOGIN.getMsg());

    public static final ResponseResult<Void> NOAUTH =
            new ResponseResult(ResultEnum.NOAUTH.getCode(), ResultEnum.NOAUTH.getMsg());
    public static final ResponseResult<Void> LOGOUT =
            new ResponseResult(ResultEnum.LOGOUT.getCode(), ResultEnum.LOGOUT.getMsg());


    //给业务代码统一返回使用
    public ResponseResult<T> ok (T data){
        return new ResponseResult<T>(200,"",data);
    }

    public ResponseResult(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

}
